
from django.http import HttpResponse
from django.shortcuts import render
from django.shortcuts import reverse,redirect

def myapp(request):
    print(reverse('myapp:turnTo'))
    return redirect(reverse('myapp:mydate',args=[2024,9,19]))

def mydate(request, year, month, day):
    return HttpResponse(str(year)+'/'+str(month)+'/'+str(day))

def time(request,x,y):
    # 使用reverse生成路由地址
    result=reverse('myapp:time')
    return HttpResponse(str(x)+'/'+str(y))

def mytime(request):
    args=['12', '13']
    # 使用reverse生成路由地址
    print(reverse('myapp:time', args=args)) 
    return HttpResponse(reverse('myapp:time', args=args))

def myapp(request):
    return render(request,'myapp.html')
def sentence(request):
    return HttpResponse(f'Hello,Django!')

def sum(request,n1,n2):
   return HttpResponse(f'The sum is {n1+n2}')


def number(request,string):
    return HttpResponse(str(string))


